package com.ity.teamanagement.controller;

import com.ity.teamanagement.annocation.CheckAuthorityStatus;
import com.ity.teamanagement.entity.inputParam.AddRotationChartParam;
import com.ity.teamanagement.entity.inputParam.DeleteRotationChartParam;
import com.ity.teamanagement.entity.inputParam.SelectRotationChartParam;
import com.ity.teamanagement.entity.inputParam.UpdateRotationChartParam;
import com.ity.teamanagement.result.Result;
import com.ity.teamanagement.service.RotationChartService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author coderFu
 * @create 2021/11/10
 */
@RestController
@Api(tags = "轮播图模块")
@RequestMapping("/rotationChart")
public class RotationChartController {

    @Autowired
    private RotationChartService rotationChartService;

    @ApiOperation("新增轮播图")
    @CheckAuthorityStatus
    @PostMapping("/addRotationChart")
    public Result addRotationChart(@RequestBody@Validated AddRotationChartParam addRotationChartParam){
        return rotationChartService.addRotationChart(addRotationChartParam);
    }

    @ApiOperation("修改轮播图")
    @CheckAuthorityStatus
    @PutMapping("/updateRotationChart")
    public Result updateRotationChart(@RequestBody@Validated UpdateRotationChartParam updateRotationChartParam){
        return rotationChartService.updateRotationChart(updateRotationChartParam);
    }

    @ApiOperation("删除轮播图")
    @CheckAuthorityStatus
    @DeleteMapping("/deleteRotationChart")
    public Result deleteRotationChart(@Validated DeleteRotationChartParam deleteRotationChartParam){
        return rotationChartService.deleteRotationChart(deleteRotationChartParam);
    }

    @ApiOperation("根据id获取轮播图详情信息")
    @GetMapping("/getRotationChartDetailsById")
    public Result getRotationChartDetailsById(@Validated SelectRotationChartParam selectRotationChartParam){
        return rotationChartService.getRotationChartDetailsById(selectRotationChartParam);
    }

    @ApiOperation("根据顺序查询轮播图列表")
    @GetMapping("/getRotationChartList")
    public Result getRotationChartList(){
        return rotationChartService.getRotationChartList();
    }
}
